package com.weishaoying.practice.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

/**
 * @author WeiShaoying
 * @date 2017/12/27
 */
public class PasswordUtil {

//    private static String algorithmName = "MD5";
//    private static int hashIterations = 1024;

    public static String generateCredent(String password, String salt) {
        String algorithmName = "MD5";
        int hashIterations = 1024;
        ByteSource saltSource = ByteSource.Util.bytes(salt);
        SimpleHash result = new SimpleHash(algorithmName, password, saltSource, hashIterations);
        System.out.println("----PasswordUtil----generateCredent = " + result);
        return result.toString();
    }


}
